<!DOCTYPE html>
<html lang="en">
<head>
    <style>
        div {
            width: 100%;
            height: 100px;
            background-color: cyan;
            color: red;
            position: absolute;
            top: -100px;
            left: 0px;
            transition: top 0.5s linear;
        }
        .display {
            top: 0px;
        }
        button {
            margin: 100px;
        }
    </style>
</head>
<body>
    <div class="display">
        我是p标签
    </div>
    <div></div>
    <div></div>
    <button>
        按钮
    </button>
    <script>
        var divEles = document.getElementsByTagName("div")[0];
        var divEle = document.querySelector("div");
        var divEles2 = document.querySelectorAll("div")[0];
        var btnEle = document.querySelector("button");
        btnEle.onmouseover = function () {
            divEle.classList.toggle("display");
        }
        btnEle.onmouseleave = function () {
            divEle.classList.toggle("display");
        }
    </script>
</body>
</html>